#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <assert.h>
//int main()
//{
//    int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
//    memmove(arr + 2, arr, 20);
//    for (int i = 0; i < 10; i++)
//        printf("%d ", arr[i]);
//}
void* my_memmove(void* dest, const void* scr, size_t num)
{
	assert(dest && scr);
	if (dest < scr)
	{
		for (int i = 0; i < num; i++)
		{
			*(char*)dest = *(char*)scr;
			dest = (char*)dest + 1;
			scr = (char*)scr + 1;
		}
	}
	else
	{
		while (num--)
		{
			*((char*)dest + num) = *((char*)scr + num);
		}
	}
} 
int main()
{
	int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
	my_memmove(arr, arr + 2, 20);
	for (int i = 0; i < 10; i++)
		printf("%d ", arr[i]);
}